package io.renren.modules.sys.service.impl;

import io.renren.modules.sys.entity.InterrogationuserVOEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;

import io.renren.modules.sys.dao.InterrogationuserDao;
import io.renren.modules.sys.entity.InterrogationuserEntity;
import io.renren.modules.sys.service.InterrogationuserService;

import java.util.*;


@Service("interrogationuserService")
public class InterrogationuserServiceImpl extends ServiceImpl<InterrogationuserDao, InterrogationuserEntity> implements InterrogationuserService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        int pageSize = Integer.parseInt(params.get("limit").toString());  //每页记录数
        int currPage = Integer.parseInt(params.get("page").toString());  //当前页数

        String username = null;
        if( params.get("username")!=null&&!params.get("username").equals("")){
            username = params.get("username").toString();
        }

        String doctorname = null;
        if( params.get("doctorname")!=null&&!params.get("doctorname").equals("")){
            doctorname = params.get("doctorname").toString();
        }
        int count = baseMapper.queryListcount(username,doctorname);
        List<InterrogationuserVOEntity> list = baseMapper.querylistByParams(username,doctorname,(currPage-1)*pageSize,currPage*pageSize);

        return new PageUtils(list,count,pageSize,currPage);
    }

}
